package{
	import flash.display.Sprite;
	import flash.display.Sprite;
	import flash.display.Graphics;
	import flash.text.TextField;
	import flash.events.MouseEvent;


	/**
	 * comment
	 */
	[swf(width=600, height=400, backgroundColor='#333333')]
	public class test extends Base{

		private var _sp:Sprite;

		public function test(){

			_sp = new Sprite;
			var g:Graphics = _sp.graphics;
			g.beginFill(0x008800);
			g.drawRect(0, 0, 100, 100);
			g.endFill();
			addChild( _sp );

			_sp.addEventListener(MouseEvent.MOUSE_DOWN, onMouseEvent);
			_sp.addEventListener(MouseEvent.MOUSE_UP, onMouseEvent);
			_sp.addEventListener(MouseEvent.MOUSE_MOVE, onMouseEvent);

			var tf:TextField = new TextField;
			addChild(tf);
			tf.autoSize = "left";
			tf.selectable = false;
			tf.text = "QQ输入法很卡!!!";
			trace("done");
		}

		private function onMouseEvent(e:MouseEvent):void{
			if( e.type != MouseEvent.MOUSE_MOVE ) trace( e.type );
			switch(e.type){
				case MouseEvent.MOUSE_DOWN:
					_sp.startDrag();
					break;
				case MouseEvent.MOUSE_UP:
					_sp.stopDrag();
					break;
				case MouseEvent.MOUSE_MOVE:
					if( ! e.buttonDown)
						_sp.stopDrag();
					break;
			}
		}
	}
}
